﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Linq.Expressions;

namespace ExpressionEvaluator
{
	/// <summary>
	/// Expression operator.
	/// </summary>
	/// <remarks>
	/// Class used to create binary expression for specified operator.
	/// </remarks>
	internal class ExpressionOperator
	{

		/// <summary>
		/// Initializes a new instance of the <see cref="ExpressionOperator"/> class.
		/// </summary>
		/// <param name="priority">The priority.</param>
		/// <param name="operatorName">Name of the operator.</param>
		/// <param name="binaryExpression">The binary expression.</param>
		public ExpressionOperator(int priority, string operatorName, Func<Expression, Expression, Expression> binaryExpression)
		{
			Priority = priority;
			OperatorName = operatorName;
			BinaryExpression = binaryExpression;
		}


		/// <summary>
		/// Gets the priority of expression operator.
		/// </summary>
		/// <value>The priority.</value>
		public int Priority
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the name of the operator in text format.
		/// </summary>
		/// <value>The name of the operator.</value>
		public string OperatorName
		{
			get;
			private set;
		}

		/// <summary>
		/// Gets the binary expression delegate.
		/// </summary>
		/// <value>The binary expression delegate.</value>
		public Func<Expression, Expression, Expression> BinaryExpression
		{
			get;
			private set;
		}
	}
}
